﻿package mortal.game.view.common.cd.effect
{
    import flash.display.*;
    import flash.events.*;
    import flash.text.*;
    import mortal.game.view.common.cd.*;

    public class CDLeftTimeEffect extends TextField implements ICDEffect
    {
        private var _cdTime:CDData;
        private var _maskBitmap:Bitmap;
        private var _currentNumber:Number = 0;
        private var _registed:Boolean = false;

        public function CDLeftTimeEffect()
        {
            mouseEnabled = false;
            return;
        }// end function

        public function set registed(param1:Boolean) : void
        {
            this._registed = param1;
            return;
        }// end function

        public function get registed() : Boolean
        {
            return this._registed;
        }// end function

        public function onTimer(param1:int) : void
        {
            if (param1 <= 0)
            {
                this.reset();
                this.dispatchEvent(new Event(Event.COMPLETE));
            }
            else if (param1 != this._currentNumber)
            {
                if (param1 >= 60)
                {
                    text = Math.floor(param1 / 60) + "m";
                }
                else
                {
                    text = param1.toString();
                }
                this._currentNumber = param1;
            }
            return;
        }// end function

        public function get cdEffectTimerType() : String
        {
            return CDEffectTimerType.Second;
        }// end function

        public function reset() : void
        {
            text = "";
            return;
        }// end function

    }
}
